Skip to content

feat(git): enforce Conventional Commits format in commit message prompt#2123

Open
pedrokpp wants to merge 2 commits into
pingdotgg:mainfrom
pedrokpp:feat/conventional-commits-prompt
Open

feat(git): enforce Conventional Commits format in commit message prompt#2123
pedrokpp wants to merge 2 commits into
pingdotgg:mainfrom
pedrokpp:feat/conventional-commits-prompt

Conversation

@pedrokpp
Copy link
Copy Markdown
Contributor

@pedrokpp pedrokpp commented Apr 17, 2026

What changed

One rule in buildCommitMessagePrompt (apps/server/src/git/Prompts.ts):

Before:

- subject must be imperative, <= 72 chars, and no trailing period

After:

- subject must follow Conventional Commits format: type(scope): description
- type must be one of: feat, fix, docs, style, refactor, test, chore
- scope is optional; description is imperative, <= 72 chars total, no trailing period

Why it should exist

t3code already enforces a naming convention for branches via sanitizeFeatureBranchName (packages/shared/src/git.ts), which hard-codes the feature/ gitflow prefix on every generated branch. The same intent — consistent, predictable output — applies to commit messages.

Right now the prompt produces freeform imperative subjects with no structure. Conventional Commits gives changelogs, tooling, and contributors a machine-readable signal without adding friction. It's the natural complement to the existing branch convention.

Closes #656.

Testing

Generate a commit message through the UI with staged changes and verify the output follows type(scope): description format.


Note

Low Risk
Low risk: only adjusts the LLM prompt text for generated commit messages, changing output formatting but not touching parsing, schemas, or git operations.

Overview
Updates buildCommitMessagePrompt in apps/server/src/git/Prompts.ts to require Conventional Commits subjects (type(scope): description) instead of a freeform imperative subject.

The prompt now constrains type to feat|fix|docs|style|refactor|test|chore, keeps scope optional, and clarifies the no-trailing-period and ≤72-character subject limit.

Reviewed by Cursor Bugbot for commit dabc6e5. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Enforce Conventional Commits format in buildCommitMessagePrompt

Updates the prompt rules in Prompts.ts to require subjects in type(scope): description format. The allowed types are feat|fix|docs|style|refactor|test|chore, scope is optional, the description must be imperative with no trailing period, and the full subject line must be ≤72 characters. Behavioral Change: any AI-generated commit messages produced via this prompt will now follow Conventional Commits structure rather than free-form imperative style.

Macroscope summarized dabc6e5.

Replaces the loose subject rule with explicit Conventional Commits
format (type(scope): description), consistent with the existing
gitflow branch naming enforced by sanitizeFeatureBranchName.
@github-actions github-actions Bot added size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 17, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 030b07b. Configure here.

Comment thread apps/server/src/git/Prompts.ts Outdated
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 07bde8df-5d4e-48e8-b8c4-ecf26f415df7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pedrokpp
Copy link
Copy Markdown
Contributor Author

Ran into this while using t3code — generated commit messages had no consistent structure, making history hard to scan and breaking tooling that expects a predictable format.

A few other attempts exist for related problems:

Those are larger in scope. This PR does one thing: adds Conventional Commits rules to the prompt, consistent with the feature/ branch naming already enforced by sanitizeFeatureBranchName. Small, focused, no new surface area — tried to stay within the contributing guidelines.

@pedrokpp
Copy link
Copy Markdown
Contributor Author

This is intentionally minimal — a temporary fix until there's a more robust solution for customizable commit conventions.

A more flexible approach could be delegating style guidelines to the user's AGENTS.md, letting each project define its own commit conventions rather than hardcoding Conventional Commits. That said, happy to keep this simple and wait for feedback on the direction you'd prefer.

@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 17, 2026

Approvability

Verdict: Approved

This change modifies AI prompt instructions to enforce Conventional Commits format for generated commit messages. It's a low-risk, self-contained change to documentation/prompt text with no runtime behavior impact beyond the format of generated commit messages.

You can customize Macroscope's approvability policy. Learn more.

@fazulk
Copy link
Copy Markdown

fazulk commented Apr 17, 2026

This is like the one thing preventing me from using t3 as a daily driver. please merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to make commit messages follow Conventional style including scopes

2 participants